import request from '@/utils/request'

// 查询排班计划列表
export function listSchedulingPlan(query) {
  return request({
    url: '/dispatch/schedulingPlan/list',
    method: 'get',
    params: query
  })
}

// 查询排班计划详细
export function getSchedulingPlan(id) {
  return request({
    url: '/dispatch/schedulingPlan/' + id,
    method: 'get'
  })
}

// 新增排班计划
export function addSchedulingPlan(data) {
  return request({
    url: '/dispatch/schedulingPlan',
    method: 'post',
    data: data
  })
}

// 修改排班计划
export function updateSchedulingPlan(data) {
  return request({
    url: '/dispatch/schedulingPlan',
    method: 'put',
    data: data
  })
}

// 删除排班计划
export function delSchedulingPlan(id) {
  return request({
    url: '/dispatch/schedulingPlan/' + id,
    method: 'delete'
  })
}

//通过计划ID获取计划数据
export function getListByPlanId(id) {
  return request({
    url: '/dispatch/schedulingPlanTimetable/getListByPlanId?planId=' + id,
    method: 'get'
  })
}

//计划排班某个部位的详情数据
export function getListByPlace(planId,place) {
  return request({
    url: `/dispatch/schedulingPlanTimetable/getListByPlace?planId=${planId}&place=${place}`,
    method: 'get'
  })
}
//计划排班某个部位的详情数据
export function getSelectListByPlace(planId) {
  return request({
    url: `/dispatch/schedulingPlanTimetable/getSelectList?planId=${planId}`,
    method: 'get'
  })
}

// 新增部位
export function addSchedulingPlanTime(data) {
  return request({
    url: '/dispatch/schedulingPlanTimetable',
    method: 'post',
    data: data
  })
}
// 批量新增部位
export function batchAddSchedulingPlanTime(data) {
  return request({
    url: '/dispatch/schedulingPlanTimetable/batchAdd',
    method: 'post',
    data: data
  })
}

// 修改部位
export function schedulingPlanTime(data) {
  return request({
    url: '/dispatch/schedulingPlanTimetable',
    method: 'put',
    data: data
  })
}

// 删除部位
export function delSchedulingPlanTime(id) {
  return request({
    url: '/dispatch/schedulingPlanTimetable/' + id,
    method: 'delete'
  })
}
